#ifndef _MOE_INTARRAYSOLUTION
#define _MOE_INTARRAYSOLUTION

#include "engine/Solution.hh"
#include "engine/Random.hh"


class IntArraySolution : public Solution {

protected:

    int *array;
    static int size;

public:

    IntArraySolution(int *array);

    IntArraySolution();

    IntArraySolution(IntArraySolution &other);

    virtual ~IntArraySolution();

    virtual int get(int i);

    virtual void set(int i, int value);

    virtual void initialize();

    virtual int length();

    virtual void send(ostream &os);

    virtual Solution *copy();

    virtual bool equals(Solution *solution) {
        IntArraySolution *intArraySolution = (IntArraySolution *) solution;

        for (int i = 0; i < IntArraySolution::size; i++)
            if (array[i] != intArraySolution->array[i]) return false;

        return true;
    }

    virtual void send(NetStream &stream) {
        Solution::send(stream);

        for (int i = 0; i < IntArraySolution::size; i++) stream << array[i];

    }

    virtual void receive(NetStream &stream) {
        Solution::receive(stream);

        for (int i = 0; i < IntArraySolution::size; i++) stream >> array[i];
    }


    static int getSize() {
        return size;
    }

    static void setSize(int size) {
        IntArraySolution::size = size;
    }

};

#endif


